<section id="<?php print $block_html_id;  ?>" >
<?
/*
?>
    <h3>Когда идет/h3>

            <?php  if (count($block->{'#places'})) : ?>
    <div class="afisha_view_selector">
        <select id="thechoices">
                <?php

                foreach ($block->{'#places'} as $p) : ?>

                    <?php $class = ''; ?>
                <option value=  <?php echo $p->field_schedule_place_nid; ?>
                    <?php if ($p->field_schedule_place_nid == $block->{'#current_place'}) : ?>
                        <?php echo "selected" ?>
                    <?php endif; ?>

                            >
                                <?php echo $p->title; ?></option>
                    <?php// echo l($p->title, 'node/' . $p->field_schedule_place_nid); ?>
<!--                    <a class="<?php echo $class; ?>" href="?place=<?php echo $p->field_schedule_place_nid; ?>"><?php echo $p->title; ?></a>-->

                <?php endforeach; ?>
       </select>
    </div>
            <?php else : ?>

                <p>На данный момент у нас нет информации о запланированных событиях в этом месте.</p>

            <?php endif; */?>


        <script type="text/javascript">
            jQuery(document).ready(function(){
                <?php foreach ($block->{'#places'} as $place) : ?>

                jQuery('#place_'+<?php echo $place->field_schedule_place_nid ; ?>).hide();


                <?php endforeach; ?>
                jQuery("#thechoices").change(function(){
                    jQuery("#place_" + this.value).show().siblings().hide();
                });

                jQuery("#thechoices").change();
            });
        </script>





    <div class="events_list">
        <?php $prevDay = null; ?>
        <?php $prevMonth = null; ?>

        <?php foreach ($block->{'#places'} as $place) : ?>
        <div id=<?php echo "place_".$place->field_schedule_place_nid ;?>>
        <?php if (count($block->{'#events'}[$place->field_schedule_place_nid])) : ?>
            <?php foreach ($block->{'#events'}[$place->field_schedule_place_nid] as $event) : ?>

            <div class="one_date">

                <?php $currentDay = date('d', strtotime($event->field_schedule_start_value)); ?>
                <?php $currentMonth = t(date('F', strtotime($event->field_schedule_start_value))); ?>
	            <?php $currentYear = date('Y', strtotime($event->field_schedule_start_value)); ?>
	            <?php $currentMonthNumber = date('m', strtotime($event->field_schedule_start_value)); ?>
	            <?php $day_week_number = date('W', strtotime($event->field_schedule_start_value)); $current_week_number = date('W', date('U')); $shift = $day_week_number - $current_week_number ?>
	            <?php $full_link_to_day = $currentDay.'_'.$currentMonthNumber.'_'.$currentYear.'&shift='.$shift?>

                <?php if (($currentDay != $prevDay || $currentMonth != $prevMonth)) : ?>
                <div class="date">
                    <div class="date_month">
                        <span class="day"><a href="/events?filter=days&<?php echo "number=$full_link_to_day";?>"> <?php echo $currentDay; ?> <?php echo $currentMonth; ?></a></span><br/>
                        <span class="month"><?php echo t(date('l', strtotime($event->field_schedule_start_value))); ?></span>
                    </div>
                </div>
                <?php $prevDay = $currentDay; ?>
                <?php $prevMonth = $currentMonth; ?>
                <?php endif; ?>

                <div class="one_event">
                    <?php if ($event->field_schedule_end_value) : ?>
                        <?php echo date('H:i', strtotime($event->field_schedule_start_value)) . '-' . date('H:i', strtotime($event->field_schedule_end_value)); ?>
                    <?php else : ?>
                        <?php echo date('H:i', strtotime($event->field_schedule_start_value)); ?>
                    <?php endif; ?>

                    <?php if (trim($event->field_schedule_price_value) != '') :?>
                    / цена: <?php echo $event->field_schedule_price_value; ?>
                    <?php endif; ?>
                </div>

            </div>


            <?php endforeach; ?>

        <?php else : ?>

        <p>На данный момент у нас нет информации о запланированных событиях в этом месте.</p>

        <?php endif; ?>
        </div>
        <?php endforeach; ?>
    </div>



</section>